//
//  Chain.swift
//  Chain
//
//  Created by Jiang Chencheng on 2024/7/25.
//

public protocol Compatible {
    associatedtype CompatibleType
    var x: CompatibleType { get }
    static var x: CompatibleType.Type { get }
}

public extension Compatible {
    var x: ChainBox<Self> { ChainBox(value: self) }
    
    static var x: ChainBox<Self>.Type { ChainBox.self }
}

public struct ChainBox<T> {
    public let value: T
    
    public init(value: T) { self.value = value }
}

public extension ChainBox {
    var instance: T { value }
}
